namespace CloudNinja.Metering.Providers.Configuration.BlobBandwidth
{
    using System.Configuration;

    using CloudNinja.Metering.Common.Configuration;

    public class BlobBandwidthMeteringProviderSettings : ConfigurationElement
    {
        [ConfigurationProperty("DefaultTenantIdPattern", IsRequired = true, DefaultValue = "tnt_{.+}")]
        public string DefaultTenantIdPattern
        {
            get
            {
                return (string)this["DefaultTenantIdPattern"];
            }

            set
            {
                this["DefaultTenantIdPattern"] = value;
            }
        }

        [ConfigurationProperty("BlobBandwidthLogsParserBookmarkRepository", IsRequired = true, DefaultValue = "Your connection string here")]
        public string BlobBandwidthLogsParserBookmarkRepository
        {
            get
            {
                var currentValue = (string)this["BlobBandwidthLogsParserBookmarkRepository"];

                return this.GetCurrentValueOrDefault(currentValue);
            }

            set
            {
                this["BlobBandwidthLogsParserBookmarkRepository"] = value;
            }
        }

        [ConfigurationProperty("StorageAccounts", IsDefaultCollection = false), ConfigurationCollection(typeof(BlobBandwidthCollectionElement), AddItemName = "addStorageAccount", ClearItemsName = "clearStorageAccount", RemoveItemName = "removeStorageAccount")]
        public BlobBandwithStorageAccountsCollection StorageAccounts
        {
            get
            {
                return this["StorageAccounts"] as BlobBandwithStorageAccountsCollection;
            }

            set
            {
                this["StorageAccounts"] = value;
            }
        }
    }
}